<?php

class DBManager {

    var $conect;
    var $baseDeDatos;
    var $servidor;
    var $usuario;
    var $clave;

    function DBManager() {
        $this->baseDeDatos = "bdadministracion";
        $this->servidor = "localhost";
        $this->usuario = "root";
        $this->clave = "12345";
//        $this->servidor = "mysql5.000webhost.com";
//        $this->baseDeDatos = "a4956373_Evento";
//        $this->usuario = "a4956373_Evento";
//        $this->clave = "sabias19901206";        
    }

    function conectar() {

        $con = new mysqli($this->servidor, $this->usuario, $this->clave, $this->baseDeDatos);
        $this->conect = $con;
        @mysql_query("SET NAMES 'utf8'");

        //verifica la conexion
        if (mysqli_connect_errno()) {
            echo "<table>";
            echo "<tr>";
            echo "<td>";
            echo "<img src='img/db_error.png' width='35' height='35' />";
            echo "</td>";
            echo "<td>";
            echo "<h3>Error al conectar a la base de datos</h3>";
            echo "</td>";
            echo "</tr>";
            echo "</table>";
            return null;
        } else {
            return $con;
        }
    }

}

?>
